import React,{ Suspense } from 'react'
import { BrowserRouter,Routes,Route,Navigate } from 'react-router-dom'
 
// 路由懒加载
const Home = React.lazy(()=>import('../pages/workbench/home/home'))
const NotFound = React.lazy(()=>import('../pages/workbench/notFound/notFound'))
const MenuDome = React.lazy(()=>import('../pages/system/menu/menu'))
const RoleDome = React.lazy(()=>import('../pages/system/role/role'))
const UserDome = React.lazy(()=>import('../pages/system/user/user'))
export default function Router(){
return(
<BrowserRouter>
    <Routes>
        <Route path='/' element={<Suspense><Home/></Suspense>}></Route>
        <Route path='/home' element={<Suspense><Home/></Suspense>}></Route>
        {/* 定义404路由*/}
        <Route path='/notFound' element={<Suspense><NotFound/></Suspense>}></Route>
        <Route path='/menuDome' element={<Suspense><MenuDome/></Suspense>}></Route>
        <Route path='/roleDome' element={<Suspense><RoleDome/></Suspense>}></Route>
        <Route path='/userDome' element={<Suspense><UserDome/></Suspense>}></Route>
        {/* 未匹配的路由使用Navigate重定向到此页面 这里即notFound.jsx */}
        {/* <Route path='/*' element={<Navigate to='/404' />}></Route>  */}
    </Routes>
</BrowserRouter>
)
}